<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn1">存储数据</button>
    <button class="btn2">获取数据</button>
    <button class="btn3">删除数据</button>
    <button class="btn4">删除所有数据</button>
    <script>
//    1.存数据
document.querySelector('.btn1').onclick=function(){
localStorage.setItem('movie','独行月球')
localStorage.setItem('movie1','独行月球1')
localStorage.setItem('movie2','独行月球2')
}
//    2.获取数据
document.querySelector('.btn2').onclick=function(){
let res=localStorage.getItem('movie1')
console.log(res);
}

//    3.删除数据
document.querySelector('.btn3').onclick=function(){
localStorage.removeItem('movie')
}

//    4.删除所有数据
document.querySelector('.btn4').onclick=function(){
localStorage.clear()
}
    </script>
</body>
</html>